package com.jeespring.order.controller;

import com.jeespring.dto.BusinessDTO;
import com.jeespring.dto.ResponseDTO;
import com.jeespring.entity.Order;
import com.jeespring.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Title: OrderController
 * @Description:
 * @Author 张朝阳
 * @Date 2020/11/29 17:52
 */
@RestController
@RequestMapping("/order")
@Slf4j
public class OrderController {

    @Reference
    private OrderService orderService;

    @GetMapping("/query")
    List<Order> query(Order order){
        log.info("查询订单：{}",order.toString());
        return orderService.query(order);
    }

    @PostMapping("/createOrder")
    ResponseDTO createOrder(@RequestBody BusinessDTO businessDTO){
        log.info("创建订单：{}",businessDTO.toString());
        return orderService.createOrder(businessDTO);
    }
}
